package com.gofun.framework.dubbo.core.environment.config;

import com.gofun.framework.dubbo.core.environment.ConfigMapping;
import com.gofun.framework.dubbo.core.environment.ResolveMappingStrategy;
import com.gofun.framework.dubbo.core.environment.DefaultResolveStrategy.ResolveStrategyEnum;

/**
 * @Project       : framework-dubbo-core
 * @Program Name  : com.ljt.framework.dubbo.core.environment.property.RegistryConfigEnum.java
 * @Description   : <dubbo:provider/> 配置枚举
 * @Author        : wangchao
 * @Creation Date : 2016年5月27日 下午4:14:09 
 * @ModificationHistory  
 * Who          When             What 
 * ----------   -------------    -----------------------------------
 * wangchao     2016年5月27日        create
 */
public enum ProviderConfigEnum implements ConfigMapping {
	
	PROTOCOL("dubbo.provider.id","协议BeanId，可以在<dubbo:service proivder=''>中引用此ID"),
	
	HOST("dubbo.provider.host","服务主机名，多网卡选择或指定VIP及域名时使用，为空则自动查找本机IP",DEV_ACTIVATED),
	
	TIMEOUT("dubbo.provider.timeout","远程服务调用超时时间(毫秒) ,默认1000,可选 "),
	
	;
	
	public String code;
	
	public String text;
	
	public String[] activated;

	public ResolveMappingStrategy resolveMapping;
	
	private ProviderConfigEnum(String code,String text) {
		this(code, text,ResolveStrategyEnum.DIRECT.resolve, ALL_ACTIVATED);
	}
	
	private ProviderConfigEnum(String code,String text,String... activated) {
		this(code, text, ResolveStrategyEnum.DIRECT.resolve, activated);
	}
	
	private ProviderConfigEnum(String code,String text,ResolveMappingStrategy resolveMapping,String... activated) {
		this.code = code;
		this.text = text;
		this.activated = activated;
		this.resolveMapping = resolveMapping;
	}
	
	@Override
	public ResolveMappingStrategy getResolveMapping() {
		return resolveMapping;
	}

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public String getText() {
		return text;
	}
	
	public String[] getActivated() {
		return activated;
	}

}
